package com.entor.controller;

import com.entor.util.JWTUtils;
import com.entor.util.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class UserController {

    @PostMapping("/login")
    public Result login(HttpServletRequest request, String username, String password){
        //认证通过后
        String token = JWTUtils.getToken(username, 10);
        return Result.success(token);
    }

    @GetMapping("/delete")
    public Result deleteById(){
        return Result.success("删除成功");
    }


    @GetMapping("/add")
    public Result add(){
        return Result.success("新增成功");
    }
}
